package Flyweight_Pattern.Java;

import java.util.Hashtable;

// -*-coding:utf-8 -*-
//人员：刘陆鑫
//班级：19软3
//学号；2019110218
public class Monitor_Factory {
    private static Monitor_Factory instance=new Monitor_Factory();
    private static Hashtable ht;

    private Monitor_Factory(){
        ht=new Hashtable();
        Monitor monitor1,monitor2,monitor3;
        monitor1=new Letter_A();
        ht.put("A",monitor1);
        monitor2=new Letter_J();
        ht.put("J",monitor2);
        monitor3=new Letter_V();
        ht.put("V",monitor3);

    }

    public static Monitor_Factory getInstance(){
        return instance;

    }

    public static Monitor getMonitor(String string){
        return (Monitor)ht.get(string);
    }
}
